package com.svse.designPattern.compositereuseprinciple;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/7/26 9:57
 */
public class CRPTest {
    public static void main(String[] args) {
        Car1 car1=new Car1();
        Car1 gasCar=new GasCar();
        Car1 electricCar=new ElectricCar();
        Car1 whiteElectricCar=new WhiteElectricCar();
        Car1 blackElectricCar=new BlackElectricCar();
        Car1 whiteGasCar=new WhiteGasCar();
        Car1 blackGasCar=new BlackGasCar();
        car1.move();
        gasCar.move();
        electricCar.move();
        whiteElectricCar.move();
        blackElectricCar.move();
        whiteGasCar.move();
        blackGasCar.move();
    }
}

//车
class Car1{
    public  void move(){
        System.out.println("车子移动");
    }
}

//汽油车
class GasCar extends Car1{
    @Override
    public void move(){
        System.out.println("GasCar 车子移动");
    }
}

class WhiteGasCar extends GasCar{
    @Override
    public void move(){
        System.out.println("WhiteGasCar 车子移动");
    }
}
class BlackGasCar extends GasCar{
    @Override
    public void move(){
        System.out.println("BlackGasCar 车子移动");
    }
}


//电动车
class ElectricCar extends Car1{
    @Override
    public void move(){
        System.out.println("ElectricCar 车子移动");
    }
}


class WhiteElectricCar extends ElectricCar{
    @Override
    public void move(){
        System.out.println("WhiteElectricCar 车子移动");
    }
}
class BlackElectricCar extends ElectricCar{
    @Override
    public void move(){
        System.out.println("BlackElectricCar 车子移动");
    }
}
